package com.eastjet.maintenance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eastjet.maintenance.domain.SubDevices;
import com.eastjet.maintenance.mapper.SubDevicesMapper;
import com.eastjet.maintenance.service.SubDevicesService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 杨博文
 * @description 针对表【sub_devices(子设备表)】的数据库操作Service实现
 * @createDate 2024-11-25 09:23:39
 */
@Service
public class SubDevicesServiceImpl extends ServiceImpl<SubDevicesMapper, SubDevices> implements SubDevicesService {


    /**
     * 新增子设备
     *
     * @param subDevices
     * @return
     */
    @Override
    public Boolean InsertSubDevice(List<SubDevices> subDevices) {
        return this.saveBatch(subDevices);
    }

    /**
     * 更新子设备
     *
     * @param subDevices
     * @return
     */
    @Override
    public Boolean UpdateSubDevice(List<SubDevices> subDevices) {
        return this.updateBatchById(subDevices);
    }

    /**
     * 删除子设备
     *
     * @param eid
     * @return
     */
    @Override
    public Boolean DeleteSubDevice(List<String> eid) {
        return this.removeByIds(eid);
    }

    /**
     * 根据设备ID查询子设备
     *
     * @param deviceId
     * @return
     */
    @Override
    public List<SubDevices> selectSubDevicesByDeviceId(String deviceId) {
        return this.list(new QueryWrapper<SubDevices>().eq("code", deviceId));
    }
}




